package com.example.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.backend.entity.ShenFen;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
@Repository
public interface ShenFenMapper extends BaseMapper<ShenFen> {
    /**
     * 登录
     */
    @Select("select * from wm_sf where yhzh = #{yhzh} and pwd = #{pwd}")
    ShenFen loginShenFen(ShenFen shenFen);

    /**
     * 更新用户余额
     */
    @Update("UPDATE wm_sf SET balance = balance + #{amount} WHERE yhid = #{yhid}")
    boolean recharge(@Param("yhid") Integer yhid, @Param("amount") Double amount);

    @Update("UPDATE wm_sf SET pwd = #{newPwd} WHERE yhzh = #{yhzh}")
    boolean forgotPwd(@Param("yhzh") String yhzh, @Param("newPwd") String newPwd);
}
